﻿package independence.reflection
{
	import __AS3__.vec.Vector;
	
	/**
	 * The IClassMirror interface defines methods for working with classes
	 * in reflection. It provides methods for many common reflection operations 
	 * such as listing declared and inherited methods, properties, fields, 
	 * interfaces, and superclasses, and many other important methods. 
	 * 
	 * @author TK, TK Assembled for Independence Glory.
	 */
	public interface IClassMirror 
	{
		/**
		 * Returns a <code>Property</code> object from the class with a name of <code>name</code.
		 * Does not return a superclass's property, only a <code>Property</code> belonging to this class.
		 * @param	name	The String name of the property.
		 * @return 	The found <code>Property</code> object.
		 * @throws	PropertyNotFoundError	If the requested Property cannot be found on the class, a PropertyNotFoundError is thrown.
		 */
		function getDeclaredProperty(name:String):Property;
		/**
		 * Returns a <code>Vector</code> of type <code>Property</code> containing all of the 
		 * class's declared properties.
		 * @return	A <code>Vector</code of type <code>Property</code> containing all of the class's declared properties.
		 */
		function getDeclaredProperties():Vector.<Property>;
		/**
		 * Returns a <code>Method</code> object from the class with a name of <code>name</code.
		 * Does not return a superclass's method, only a <code>Method</code> belonging to this class.
		 * @param	name	The String name of the method.
		 * @return 	The found <code>Method</code> object.
		 * @throws	MethodNotFoundError	If the requested Method cannot be found on the class, a MethodNotFoundError is thrown.
		 */
		function getDeclaredMethod(name:String):Method;
		/**
		 * Returns a <code>Vector</code> of type <code>Method</code> containing all of the 
		 * class's declared methods.
		 * @return	A <code>Vector</code of type <code>Method</code> containing all of the class's declared methods.
		 */
		function getDeclaredMethods():Vector.<Method>;
		/**
		 * Returns a <code>Constant</code> object from the class with a name of <code>name</code>.
		 * Returns any constant found in the class's inheritance line.
		 * @param	name	The String name of the constant.
		 * @return	The found <code>Constant</code> object.
		 * @throws	ConstantNotFoundError	If the requested Constant cannot be found on the class, a ConstantNotFoundError is thrown.
		 */
		function getConstant(name:String):Constant;
		/**
		 * Returns a <code>Vector</code> of type <code>Constant</code> containing all of the 
		 * class's constants.
		 * @return	A <code>Vector</code of type <code>Constant</code> containing all of the class's constants.
		 */	
		function getConstants():Vector.<Constant>;
		/**
		 * Returns a <code>Field</code> object from the class with a name of <code>name</code.
		 * Returns any field found in the class's inheritance line.
		 * @param	name	The String name of the field.
		 * @return 	The found <code>Field</code> object.
		 * @throws	FieldNotFoundError	If the requested Field cannot be found on the class, a FieldNotFoundError is thrown.
		 */
		function getField(name:String):Field;
		/**
		 * Returns a <code>Vector</code> of type <code>Field</code> containing all of the 
		 * class's fields.
		 * @return	A <code>Vector</code of type <code>Field</code> containing all of the class's fields.
		 */
		function getFields():Vector.<Field>;
		/**
		 * Returns all interfaces implemented by this class and its ancestors.
		 * @return	A <code>Vector</code> of type <code>Class</code> containing all of the class's implemented interfaces.
		 */
		function getInterfaces():Vector.<Interface>;
		/**
		 * Returns a <code>Property</code> object from the class with a name of <code>name</code.
		 * Returns any property found in the class's inheritance line.
		 * @param	name	The String name of the property.
		 * @return 	The found <code>Property</code> object.
		 * @throws	PropertyNotFoundError	If the requested Property cannot be found on the class, a PropertyNotFoundError is thrown.
		 */
		function getProperty(name:String):Property;
		/**
		 * Returns a <code>Vector</code> of type <code>Property</code> containing all of the 
		 * class's properties.
		 * @return	A <code>Vector</code of type <code>Property</code> containing all of the class's properties.
		 */
		function getProperties():Vector.<Property>;
		/**
		 * Returns a <code>Method</code> object from the class with a name of <code>name</code.
		 * Returns any method found in the class's inheritance line.
		 * @param	name	The String name of the method.
		 * @return 	The found <code>Method</code> object.
		 * @throws	MethodNotFoundError	If the requested Method cannot be found on the class, a MethodNotFoundError is thrown.
		 */
		function getMethod(name:String):Method;
		/**
		 * Returns a <code>Vector</code> of type <code>Method</code> containing all of the 
		 * class's methods.
		 * @return	A <code>Vector</code of type <code>Method</code> containing all of the class's methods.
		 */
		function getMethods():Vector.<Method>;
		/**
		 * Returns the fully-qualified name of the class.
		 * @return	The fully-qualified name of the class.
		 */
		function getName():String;
		/**
		 * Returns the package name of the class.
		 * @return	The package name of the class.
		 */
		function getPackage():String;
		/**
		 * Returns the simple name of the class object without its package.
		 * @return	The simple name of the class.
		 */
		function getSimpleName():String;
		/**
		 * Returns the immediate superclass of the class.
		 * @return	The immediate superclass's class object.
		 */
		function getSuperclass():Class;
		/**
		 * Returns a <code>Vector</code> of type <code>Class</code> representing all of the class's superclasses.
		 * @return	A <code>Vector</code> of type<code>Class</code> of the class's superclasses.
		 */
		function getSuperclasses():Vector.<Class>;
		/**
		 * Evaluates whether <code>value</code> is an instance of the class.
		 * @return	True if the <code>value</code> object is an instance of the target class.
		 */
		function isInstance(value:Object):Boolean;
		/**
		 * Constructs a new instance of the class, so long as it takes no parameters.
		 * @return	A new instance of the class.
		 */
		function newInstance():Object;
		/**
		 * Returns a String representation of this instance.
		 * @return	A String representation of this ClassMirror instance.
		 */
		function toString():String;
	}
	
}